// 导入组件
import Vue from 'vue';
import Router from 'vue-router';
// 登录
import login from '@/views/login';
// 首页
import index from '@/views/index';
import User from "../views/group/User";
import UserInfo from "../views/group/UserInfo";
//基础管理--仓库信息
import cangkuxinxi from "../views/jichuxinxi/cangkuxinxi.vue";
//基础管理--供应商信息
import gongyingshang from "../views/jichuxinxi/gongyingshang.vue";
import purchaseEnWarehouse from "../views/enWarehouse/purchaseEnWarehouse.vue";
import ReturnIn from "../views/inboundManage/ReturnIn.vue";
// 库存管理
import warehouseInventory from "../views/kcWarehouse/warehouseInventory";//引入仓库库存清单
import inventory from "../views/kcWarehouse/inventory";//引入库名明细
import inventoryLog from "../views/kcWarehouse/inventoryLog";//引入库名流水
import shangpinfenlei from "../views/jichuxinxi/shangpinfenlei.vue";
import shangpin from "../views/jichuxinxi/shangpin.vue";
import shangpinxinxi from "../views/jichuxinxi/shangpinxinxi.vue";

//订单管理
import OrderManage from "../views/orderManage/OrderManage.vue";
import AddNewOrder from "../views/orderManage/ordexView/AddNewOrder.vue";
import PurchaseOrder from "../views/orderManage/ordexView/PurchaseOrder.vue";




/**
 * 基础菜单
 */

// 启用路由
Vue.use(Router);

// 导出路由
export default new Router({
  routes: [
    {
      path: '/', // 访问根路径 ===就是访问login组件
      name: '',
      component: index,
      hidden: true,
      meta: {
        requireAuth: false   //访问 /路径是否需要权限
      }
    },
    {
      path: '/login', // 匹配login 路径
      name: '登录',
      component: login,
      hidden: true,
      meta: {
        requireAuth: false
      }
    },
    {
      path: '/index',  // 匹配index路径
      name: '首页',
      component: index,
      iconCls: 'el-icon-tickets',
      children: [    //配置子路由
        // 个人中心
        {
          path: 'user/info',
          component: UserInfo,
          meta: {
            requireAuth: false
          },
        },
        // 用户模块
        {
          path: 'group/user',
          name: 'User',
          component: User,
          meta: {
            requireAuth: true
          },
        },
        // 基础信息模块
        {
          path: 'jichuxinxi/cangkuxinxi',
          name: 'cangkuxinxi',
          component: cangkuxinxi,
          meta: {
            requireAuth: true
          }
        },
        {
          path: 'jichuxinxi/gongyingshang',
          name: 'gongyingshangxinxi',
          component: gongyingshang,
          meta: {
            requireAuth: true
          }
        },
        {
          path: 'jichuxinxi/shangpinfenlei',
          name: 'shangpinfenlei',
          component: shangpinfenlei,
          meta: {
            requireAuth: true
          }
        },
        {
          path: 'jichuxinxi/shangpin',
          name: 'shangpin',
          component: shangpin,
          meta: {
            requireAuth: true
          }
        },
        {
          path: 'jichuxinxi/shangpinxinxi',
          name: 'shangpinxinxi',
          component: shangpinxinxi,
          meta: {
            requireAuth: true
          }
        },
        //入库管理
        {
          path: 'purchaseEnWarehouse',
          name: 'PurchaseEnWarehouse',
          component: purchaseEnWarehouse,
          meta: {
            requireAuth: false
          },
        },
        //退货入库
        {
          path: 'inboundManage/returnIn',
          name: 'ReturnIn',
          component: ReturnIn,
          meta: {
            requireAuth: false
          },
        },
        /**
         * 库存管理
         */
        {//库名明细
          path: 'inventory',
          name: 'inventory',
          component: inventory,
          meta: {
            requireAuth: false
          },
        },
        {//库名流水
          path: 'inventoryLog',
          name: 'inventoryLog',
          component: inventoryLog,
          meta: {
            requireAuth: false
          },
        },
        {//仓库库存清单
          path: 'warehouseInventory',
          name: 'warehouseInventory',
          component: warehouseInventory,
          meta: {
            requireAuth: false
          },
        },
        //订单管理
        {
          path: 'order',  // 匹配index路径
          name: 'OrderManage',
          component: OrderManage,
          iconCls: 'el-icon-tickets',
          meta: {
            requireAuth: false
          },
          children:[
            {//采购订单
              path: 'purchaseOrder',
              name: 'PurchaseOrder',
              component: PurchaseOrder,
              meta: {
                requireAuth: false
              },
            },
            {//新增修改界面
              path: 'addNewOrder',
              name: 'AddNewOrder',
              component: AddNewOrder,
              meta: {
                requireAuth: false
              }
            },
          ]
        },
      ]
    },
  ]
})
